package cn.javase.base.multithread._02_线程休眠与终止;

public class _01_线程休眠面试题 {

    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        myThread.start();
        myThread.sleep(5000); // 本质上还是 Thread.sleep(5000);
        for (int i = 0; i < 4; i++) {
            System.out.println("main方法:" + i);
        }
    }

    private static class MyThread extends Thread {
        @Override
        public void run() {
            Thread.currentThread().setName("自定义线程");
            for (int i = 0; i < 4; i++) {
                System.out.println(Thread.currentThread().getName() + ":" + i);
            }
        }
    }

}

